package classwork.demo3;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class day3 {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db2",
                "root", "root");
        Statement st = con.createStatement();
        ResultSet re = st.executeQuery("select * from stu");
        while (re.next()){
            System.out.println(re.getString("id")+"\t"+re.getString("name")
                   +"\t"+re.getString("password"));
        }
        con.close();
    }
}
